Skip to content

feat(events): define v1 semantic route descriptors - #170

Merged
ScriptedAlchemy merged 1 commit into
mainfrom
wave4/97-event-routes
Sep 1, 2026
Merged

feat(events): define v1 semantic route descriptors#170
ScriptedAlchemy merged 1 commit into
mainfrom
wave4/97-event-routes

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Summary

  • admit exactly the seven G10 event-route identities, including root src/events/stop.tsx
  • publish typed canonical/native event props and validate event routes as async default Server Components without MCP schemas
  • add <Agent.Context> to the Agent Document vocabulary and MCP text projection

Evidence table additions

  • none in this descriptor/discovery slice; host evidence and support states follow in the next PR

Lane D coordination

  • runtime edits are confined to the Agent.Context vocabulary node, decoder, exports, and projector support

Test plan

  • pnpm exec rstest run packages/rsc-runtime/tests/agent-document.test.ts packages/rsc-runtime/tests/dispatcher.test.ts packages/agent-bundle/tests/route-graph.test.ts packages/agent-bundle/tests/entry-shell.test.ts (56 passed)
  • pnpm typecheck
  • pnpm lint

Closes part of #97

Admit only the seven G10 event families, type their canonical/native props, and add Agent.Context as the immediate guidance vocabulary.
@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a7f51a7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agent-bundle Minor
@agent-bundle/runtime Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T18:19:43.806422Z a7f51a7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7f51a7f06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +41 to +42
route.kind === 'event-route'
? ` ${JSON.stringify(route.id)}: EventRouteContract<typeof route${String(index)}.default, ${JSON.stringify(route.event)}>;`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Separate event routes from input/result aliases

When a graph contains any newly admitted event route, this branch adds an EventRouteContract containing only component and event to AgentBundleRoutes, while the emitted RouteInput and RouteResult aliases at lines 47–48 still unconditionally index every RouteId by input and result. TypeScript therefore reports TS2536 while checking the generated routes.d.ts, preventing consumers from type-checking generated declarations for projects with event routes. Restrict those aliases to schema-based route IDs or extract the properties conditionally.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #198 (merged as d992838). The generated declarations now route RouteInput/RouteResult through conditional ContractInput/ContractResult helpers: schema routes keep their schema-derived types, and event routes resolve the component's props and awaited return type instead of erroring on the missing input/result members. Covered by a typegen fixture test plus a type-level test that compiles the generated routes.d.ts and asserts exact resolution for both route kinds.

Comment on lines +41 to +44
export interface AgentEventRouteProps {
readonly canonical: AgentEventCanonicalIdentity;
readonly native: AgentEventNativePayload;
readonly signal: AbortSignal;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the published event props from the route test harness

Consumers authoring against this new public contract cannot exercise their event routes through agent-bundle/test: componentProps in src/test/render.ts still passes { event, payload, signal } for event-route, rather than { canonical, native, signal }, and its event value is the prefixed route ID such as event:tool/after. Consequently, routes that destructure the newly documented canonical or native props receive undefined and may fail during route-unit rendering; the harness needs to construct the same canonical/native envelope promised here.

Useful? React with 👍 / 👎.

@pkg-pr-new

pkg-pr-new Bot commented Sep 1, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@170
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@170
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@170

commit: a7f51a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant